package lc.oa.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import lc.oa.R;
import lc.oa.model.Schedule;

public class ScheduleAdapter extends BaseAdapter {
    private LayoutInflater liny;
    List<Schedule> scheduleList;
    public  ScheduleAdapter(Context context, List<Schedule> list){
        liny=LayoutInflater.from(context);
        scheduleList=list;

    }
    @Override
    public int getCount() {
        return scheduleList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view=liny.inflate(R.layout.schedule_list_item,null);//通过mInflater来加载布局
        TextView tv1= view.findViewById(R.id.af_txt);
        TextView tv2=view.findViewById(R.id.morn_txt);
        TextView tv3= view.findViewById(R.id.desc_txt);
        tv1.setText(scheduleList.get(i).getMorning());
        tv2.setText(scheduleList.get(i).getAfternoon());
        tv3.setText(scheduleList.get(i).getContent());
        return view;
    }
}
